package cn.ujn.medicalbackend.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName city
 */
@TableName(value ="city")
@Data
public class City implements Serializable {
    /**
     * 城市编号
     */
    @TableId(value = "city_id", type = IdType.AUTO)
    private Long cityId;

    /**
     * 创建时间
     */
    @TableField(value = "createtime")
    private Date createtime;

    /**
     * 更新时间
     */
    @TableField(value = "updatetime")
    private Date updatetime;

    /**
     * 城市编号
     */
    @TableField(value = "city_number")
    private Integer cityNumber;

    @TableField(exist = false)
    private String province;//省份

    @TableField(exist = false)
    private String city;//市

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        City other = (City) that;
        return (this.getCityId() == null ? other.getCityId() == null : this.getCityId().equals(other.getCityId()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()))
            && (this.getUpdatetime() == null ? other.getUpdatetime() == null : this.getUpdatetime().equals(other.getUpdatetime()))
            && (this.getCityNumber() == null ? other.getCityNumber() == null : this.getCityNumber().equals(other.getCityNumber()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCityId() == null) ? 0 : getCityId().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        result = prime * result + ((getUpdatetime() == null) ? 0 : getUpdatetime().hashCode());
        result = prime * result + ((getCityNumber() == null) ? 0 : getCityNumber().hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "City{" +
                "cityId=" + cityId +
                ", createtime=" + createtime +
                ", updatetime=" + updatetime +
                ", cityNumber=" + cityNumber +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                '}';
    }
}